package com.sw.c.utils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * @author xiaolwi
 * @time 2022/12/28 15:28
 */

@ApiModel
public class ResponseMO implements Serializable {

    private static final long serialVersionUID = 1L;
    public static final int RESPONSE_CODE_FAILURE = 0;
    public static final int RESPONSE_CODE_SUCCESS = 1;
    @ApiModelProperty("状态码")
    private int code = RESPONSE_CODE_SUCCESS;  //成功为1   失败为0
    @ApiModelProperty("消息")
    private String msg = "";
    @ApiModelProperty("数据")
    private Object data;
    private String debugInfo;

    public ResponseMO() {
    }

    public boolean checkFailure() {
        boolean result = false;
        if (this.code == RESPONSE_CODE_FAILURE) {
            result = true;
        }
        return result;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public void setResponseCodeFailure() {
        this.code = RESPONSE_CODE_FAILURE;
    }

    public String getDebugInfo() {
        return debugInfo;
    }

    public void setDebugInfo(String debugInfo) {
        this.debugInfo = debugInfo;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

}
